package jiangyeheng;

//C,D
//A,B,E,F,G
//A，E

import java.util.Random;
public class Main {
    public static void main(String[] args) {
        double[] arr=new double[10];
        Random ranDou=new Random();
        for(int i=0;i<10;i++){
            arr[i]=ranDou.nextDouble()*10;
        }
        for(int i=0;i<10;i++){
            System.out.println(arr[i]);
        }

        MinAndMax end=MinAndMax.getResult(arr);
        System.out.println("最小值："+end.getMin());
        System.out.println("最大值："+end.getMax());
    }
}
class MinAndMax{
    private double max;
    private double min;

    public double getMin() {
        return min;
    }

    public double getMax() {
        return max;
    }

    public MinAndMax(double min,double max){
        this.min=min;
        this.max=max;
    }

    static class GetMinAndMax extends MinAndMax {

        private GetMinAndMax(double min, double max) {
            super(min,max);
        }

    }

    static MinAndMax getResult(double[]arr){
        double max=-1;
        double min=99999;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];
            }
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return new GetMinAndMax(min,max);
    }
}
